home *** CD-ROM | disk | FTP | other *** search
- Path: ix.netcom.com!netnews
- From: miker3@ix.netcom.com (Mike Rubenstein)
- Newsgroups: comp.lang.c++
- Subject: Re: Memory allocation.
- Date: Sun, 11 Feb 1996 14:01:12 GMT
- Organization: Netcom
- Message-ID: <311df641.156228704@nntp.ix.netcom.com>
- References: <1996Feb10.161530.26449@wisipc.weizmann.ac.il> <00001a81+00009e86@msn.com>
- NNTP-Posting-Host: ix-dc12-11.ix.netcom.com
- X-NETCOM-Date: Sun Feb 11 6:00:42 AM PST 1996
- X-Newsreader: Forte Agent .99d/32.182
-
- Tendrils@msn.com (kelvin ) wrote:
-
- > The program may or may not works...
- > try adding another function call in main()...before cout.
- >
- > e.g.
- >
- > int func2(int input)
- > {
- > return input;
- > }
- >
- > int
- > main()
- > {
- > int* x=func();
- >
- > int y=func2(22); // add this!!!
- >
- > cout<<x[2]<<endl;
- >
- > return(1);
- > }
-
- Which may or may not work. Adding the new function has nothing to do
- with the problem in the original that func() was returning a pointer
- to an auto that was deallocated when func() returned.
-
- Is it really necessary to post this kind of nonsense?
-
-
- Michael M Rubenstein
-